package com.study.component2;

import com.study.component2.MyFactoryBean.MyBean;
import lombok.Data;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;

/**
 * @Author tanglingyu
 * @Date: 2021/09/01/ 10:13
 * @Description
 */
@Component
public class MyFactoryBean implements FactoryBean<MyBean> {

  @Override
  public MyBean getObject() throws Exception {
    return new MyBean();
  }

  @Override
  public Class<?> getObjectType() {
    return MyBean.class;
  }

  @Override
  public boolean isSingleton() {
    return true;
  }

  @Data
  public static class MyBean {

    private String name = "sb";
  }
}
